<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.2"
	xmlns:c="http://java.sun.com/jsp/jstl/core"
	xmlns:u="urn:jsptagdir:/WEB-INF/tags/util/"
	xmlns:fmt="http://java.sun.com/jsp/jstl/fmt"
	xmlns:s="http://www.springframework.org/tags">
<jsp:directive.page contentType="text/html" pageEncoding="UTF-8" />
	<c:url value="/" var="rootURL" />
	<div class="page-header">
		<div class="row">
			<div class="span7">
				<h1>${account.label}</h1>
				<s:message code="account.id" arguments="${account.accountId}" />
			</div>
			<div class="span5 align-right">
				<h1><u:outBalance value="${account.balance}" /></h1>
			</div>
		</div>
	</div>
	<u:monthsBar selectedYear="${selectedYear}" selectedMonth="${selectedMonth}" history="${history}" url="${rootURL}account/${account.accountId}" />
	<div class="row">
		<div class="span6">
			<h3 class="capitalized">
				<fmt:parseDate value="${lastDateSelectedMonth}" var="parsedDate" pattern="yyyy-MM-dd'T'HH:mm:ss.SSSXXX" />
				<fmt:formatDate value="${parsedDate}" pattern="MMMM yyyy" />
			</h3>
		</div>
		<div class="span6 align-right">
			<a class="btn btn-primary" href="${rootURL}download/xls/${account.accountId}/${selectedYear}/${selectedMonth}"><s:message code="account.download" /></a>
		</div>
	</div>
	<table class="table table-striped">
		<thead>
			<tr>
				<th colspan="2">
					<c:set var="lastDateSelectedFormated">
						<u:shortDate value="${lastDateSelectedMonth}" />
					</c:set>
					<s:message code="account.balanceAt" arguments="${lastDateSelectedFormated}" />
				</th>
				<c:choose>
					<c:when test="${lastBalanceSelectedMonth &lt; 0}">
						<th><u:outBalance value="${lastBalanceSelectedMonth}" /></th>
						<th></th>
					</c:when>
					<c:otherwise>
						<th></th>
						<th><u:outBalance value="${lastBalanceSelectedMonth}" /></th>
					</c:otherwise>
				</c:choose>
			</tr>
			<tr>
				<th class="span2"><s:message code="table.transaction.date" /></th>
				<th class="span5"><s:message code="table.transaction.label" /></th>
				<th class="span2"><s:message code="table.transaction.debit" /></th>
				<th class="span2"><s:message code="table.transaction.credit" /></th>
			</tr>
		</thead>
		<tbody>
			<tr>
				<td></td>
				<td><a href="${rootURL}account/${account.accountId}/card/${selectedYear}/${selectedMonth}"><s:message code="account.cards" /></a></td>
				<c:choose>
					<c:when test="${creditCardOperationsSum &lt; 0}">
						<td><u:outBalance value="${-creditCardOperationsSum}" /></td>
						<td></td>
					</c:when>
					<c:otherwise>
						<td></td>
						<td><u:outBalance value="${creditCardOperationsSum}" /></td>
					</c:otherwise>
				</c:choose>
			</tr>
			<c:forEach items="${transactions}" var="transaction">
				<tr>
					<td><u:shortDate value="${transaction.date}" /></td>
					<td>${transaction.label}</td>
					<c:choose>
						<c:when test="${transaction.amount &lt; 0}">
							<td><u:outBalance value="${-transaction.amount}" /></td>
							<td></td>
						</c:when>
						<c:otherwise>
							<td></td>
							<td><u:outBalance value="${transaction.amount}" /></td>
						</c:otherwise>
					</c:choose>
				</tr>
			</c:forEach>
		</tbody>
		<tfoot>
			<tr>
				<th colspan="2">
					<c:set var="firstDateSelectedFormated">
						<u:shortDate value="${firstDateSelectedMonth}" />
					</c:set>
					<s:message code="account.balanceAt" arguments="${firstDateSelectedFormated}" />
				</th>
				<c:choose>
					<c:when test="${firstBalanceSelectedMonth &lt; 0}">
						<th><u:outBalance value="${firstBalanceSelectedMonth}" /></th>
						<th></th>
					</c:when>
					<c:otherwise>
						<th></th>
						<th><u:outBalance value="${firstBalanceSelectedMonth}" /></th>
					</c:otherwise>
				</c:choose>
			</tr>
		</tfoot>
	</table>
	<u:pagesBar currentPage="${currentPage}" nbPages="${nbPages}" url="${rootURL}account/${account.accountId}/${selectedYear}/${selectedMonth}" />
</jsp:root>